package main

import (
	"geek-homework/week04/internal/pkg/cfg"
	"github.com/gin-gonic/gin"
	"net/http"
)

func main() {
	srv, cleanup, err := initApp()
	if err != nil {
		panic(err)
	}
	defer cleanup()
	srv.ListenAndServe()
}

func newApp(config *cfg.Config, router *gin.Engine) *http.Server {
	return &http.Server{Addr: config.Server.Http.Addr, Handler: router}
}
